import { commonTableOptions } from "@/utils/options"


export function tableOption () {
  const self = this;
  return {
    ...commonTableOptions,
    // height: self?.documentHeight - 380,
    header: true,
    column: [
      {
        label: "所在部门",
        search: false,
        prop: "departName",
        // props: {
        //   label: "name",
        //   value: "id",
        //   children: "childList",
        // },
        // hide: false,
        // overHidden: true,
        // rules: [
        //   { required: true, message: "所在部门不能为空", trigger: "change" },
        // ],
        // filter: false,
        // type: "tree",
        // dicData: self.treeList,
      },
      {
        label: "职务名称",
        prop: "name",
        hide: false,
        rules: [
          { required: true, message: "职务名称不能为空", trigger: "blur" },
          {
            min: 1,
            max: 20,
            message: "长度在 1 到 20 个字符",
            trigger: "blur",
          },
        ],
        maxlength: 20,
        search: false,
        overHidden: true,
      },
      {
        label: "排序",
        prop: "sort",
        hide: true,
        type: "number",
        min: 0,
        search: false,
        overHidden: true,
        value: "",
      },
      // {
      //   label: "所在部门",
      //   search: false,
      //   prop: "departName",
      //   hide: false,
      //   overHidden: true,
      //   editDisplay: false,
      //   addDisplay: false,
      // },
      {
        label: "是否部门领导",
        prop: "leader",
        hide: false,
        search: false,
        span: 24,
        type: "radio",
        rules: [
          {
            required: true,
            message: "是否部门领导不能为空",
            trigger: "change",
          },
        ],
        value: "0",
        dicData: [
          {
            label: "是",
            value: "1",
          },
          {
            label: "否",
            value: "0",
          },
        ],
      },

      {
        label: "职务描述",
        search: false,
        prop: "describe",
        hide: false,
        overHidden: true,
        type: "textarea",
        rules: [{ max: 50, message: "长度在 50 个字符内", trigger: "blur" }],
        maxlength: 100,
      },
    ],
  }
};

export const treeOption = function () {
  const self = this;
  return {
    isDialogFullscreen: false,
    defaultExpandAll: true,
    filter: true,
    menu: false,
    addBtn: false,
    editBtn: false,
    delBtn: false,
    accordion: false,
    props: {
      label: "name",
      value: "id",
      children: "childList",
    },
    formOption: {
      labelWidth: 100,
      span: 24,
      column: [
        {
          label: "上级部门",
          prop: "parentId",
          type: "tree",
          filter: false,
          multiple: false,
          dicData: self.treeList,
          props: {
            label: "name",
            value: "id",
            children: "childList",
          },
        },
        {
          label: "部门名称",
          prop: "name",
        },
      ],
    },
  };
};
